package com.twu.biblioteca;

import java.util.Objects;

/**
 * Created by Binsabbar on 01/10/2014.
 */
public class Movie {

  String movieName;
  Director director;
  int releaseYear;
  int rating;

  public Movie(String movieName, int releaseYear, Director director, int rating) {
    this.movieName = movieName;
    this.releaseYear = releaseYear;
    this.director = director;
    if (rating > 10 || rating < 1) {
      this.rating = 0;
    } else {
      this.rating = rating;
    }
  }

  public boolean equals(Object object){
    if (!(object instanceof Movie)) return false;

    Movie anotherMovie = (Movie) object;
    return this.movieName.equals(anotherMovie.movieName) && this.releaseYear==anotherMovie.releaseYear &&
           this.director.equals(anotherMovie.director);
  }
}
